public class AccountExtension {
    private Account a;
    public List<Contact> contacts {get; set;}
    
    public AccountExtension(ApexPages.StandardController controller){        
        a = (Account)controller.getRecord();
        contacts = [Select Name, Id From Contact where AccountId = :a.Id];
    }
    
    public List<Contact> getContacts(){
        contacts = [Select Name, Id From Contact where AccountId = :a.Id];
        return contacts;
    }

}